package com.ak.server.platform.service.impl;

import com.ak.common.entity.QueryRequest;
import com.ak.common.entity.constant.AKConstant;
import com.ak.common.entity.system.Datasource;
import com.ak.common.utils.SortUtil;
import com.ak.server.platform.mapper.DatasourceMapper;
import com.ak.server.platform.service.IDatasourceService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;


/**
 * 数据源业务实现
 *
 * @author Vean
 */
@Service
public class DatasourceServiceImpl extends ServiceImpl<DatasourceMapper, Datasource> implements IDatasourceService {

    @Override
    public IPage<Datasource> selectDatasourceList(Datasource datasource, QueryRequest request) {
        Page<Datasource> page = new Page<Datasource>(request.getPageNum(), request.getPageSize());
        SortUtil.handlePageSort(request, page, "database_ip", AKConstant.ORDER_ASC, false);
        return this.baseMapper.selectDatasourceList(page, datasource);
    }
}
